<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>ajax-formData请求方法</title>
		<script src="jquery.js"></script>
	</head>
	<body>
		<form action="index.html" method="get" enctype="multipart/form-data">
			<input type="text" name="username" placeholder="请输入用户名"/> <br />
			<input type="password" name="password" placeholder="请输入密码" /><br />
			<input type="file" name="photo"/><br />
			<button type="submit">登录</button>
		</form>
		<script>
			$('form').submit(function(ev){
				ev.preventDefault();
			
				var data = new FormData(this);
				data.append('time',new Date());
				console.log(data);
				$.post({
					url:'index.html',
					data:data,
					processData:false,//阻止默认的数据内容被转化成字符串，提交设置的类型
					contentType:false,//默认内容类型是Urlencoded,阻止默认的内容类型，，提交设置的类型
					success:function(resData){
						
					}
				})
			})
		</script>
	</body>
</html>
